﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using kysec.RAL.EFToMySql;

namespace kysec.Bll.Message
{
    public class vw_msg_replay
    {
        /// <summary>
        /// 得到具体的某一条信息的留言
        /// </summary>
        /// <param name="id">留言Id</param>
        /// <param name="type">类型：0：客户反馈 1：留言薄</param>
        /// <returns>返回找到的信息</returns>
        public static List<vw_msg_repmsg> getMsaage(string id,int type)
        {
            MySql_kysecContectionString ctx = new MySql_kysecContectionString();
            try
            {
                id = kysec.CR.Common.EncodeByBase64.Decode(id);
                var list = ctx.vw_msg_repmsg.Where(c => c.c_i_typeId == type && c.c_uq_mId.Equals(id) && c.c_b_isReplay == true).ToList();

                if (list.Count == 0)
                {
                    return new List<vw_msg_repmsg>();
                }

                return list;

            }
            catch (Exception ex)
            {
                kysec.CR.Logger.MyLogger.Error(typeof(vw_msg_replay), "查找具体的某一条已回复的留言时出错！\t" + ex.ToString());
            }
            finally { ctx.Dispose(); }
            return new List<vw_msg_repmsg>();
        }


    }
}
